package org.apache.felix.dm.impl.dependencies.bi;

public class Toggle {
    private boolean m_isAvailable;
    private Runnable m_runnable;
    
    boolean isAvailable() {
        return m_isAvailable;
    }
    void setAvailable(boolean isAvailable) {
        boolean changed = m_isAvailable != isAvailable;
        m_isAvailable = isAvailable;
        Runnable r = m_runnable;
        if (r != null && changed) {
            r.run();
        }
    }
    void setRunnable(Runnable runnable) {
        m_runnable = runnable;
    }
}